<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<%@ page import="org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter" %>
<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %>
<%@ page import="org.springframework.security.web.WebAttributes" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>登录页</title>
	<%@ include file="/common/meta.jsp" %>
	<script src="${ctx}/js/jquery.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/jquery.validate.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/messages_cn.js" type="text/javascript"></script>
<style>
.box {
height: 110px;
top: 30%;
left: 40%;
background: rgb(255, 255, 255);
border: 1px solid rgb(153, 153, 153);
overflow: hidden;
position: absolute;
padding: 20px;
margin:0px;
width: 260px;
}
.box input{
  background: rgb(255, 255, 230);
  border: 1px rgba(0, 0, 255, 0.46) solid;
}

.mini-button
{
    padding:0;
    border:1px solid #A9ACB5;
    background:#EBEDF2 url(${ctx}/images/pro/button.png) repeat-x 0 0;
    
    font-size:9pt;
    font-family:Tahoma,Verdana,宋体;
    
    line-height:22px;
    
    text-decoration:none;
    text-align: center;
    display:inline-block;
    zoom:1;    
    cursor:pointer;   
    outline:none;
}
.mini-button, a.mini-button
{
    color:#201F35;
}
body a:hover.mini-button
{    
    padding:0;
    border:1px solid #A9ACB5;
    background:#dde6fe url(images/button/hover.png) repeat-x 0 0;      
    text-decoration:none;
}
</style>
</head>
<body style="background: rgb(197, 199, 202);">
<div class="box">
    <div class="red"></div>
	<form id="loginForm" action="${ctx}/j_security_check" method="post" style="margin-top:1em">
		<table class="noborder">
			<tr>
				<td><label>用户名:</label></td>
				<td><input type='text' id='j_username' value="admin" name='j_username' class="required"
					<s:if test="not empty param.error">
						value='<%=session.getAttribute(UsernamePasswordAuthenticationFilter.SPRING_SECURITY_FORM_PASSWORD_KEY)%>'</s:if> />
				</td>
			</tr>
			<tr>
				<td><label>密码:</label></td>
				<td><input type='password' id='j_password' value="huming1" name='j_password' class="required"/></td>
			</tr>
			<tr>
				<td colspan='2' align="center" >
                   <a class="mini-button marY8" href="javascript:void(0)" style="width: 60px;" id="submit">
                     <span class="mini-button-text ">登录</span>
                   </a>
				</td>
			</tr>
		</table>
	</form>
</div>

	<script>
	
	function L()
	{
	  $.getJSON("${ctx}/login!domainLogin.action",{userName:$("#j_username").val(),passwd:$("#j_password").val()},
		      function(response)
		      {
			     if(!response||!response.code)
			     {
			    	alert("no data"); return; 
			     }
			     if(response.code!=200)
		    	 {
		    	    $(".red").html(response.message);
		    	    return;
		    	 }
			     $("#loginForm").submit();
		      }
	  );	
	}		
	
	$(document).ready(function() {
		$("#loginForm").validate();
		
		$("#submit").click(function(){
			 L();
		});
		
	});
	</script>


</body>
</html>

